﻿'*********************************************************************
'/// <summary>
'// Name of File     :   UploadeSourcePresenter.vb
'// Author           :   Sukhminder Singh
'// Create date      :   15th Nov 2011
'/// </summary>
'***********************************************************************
Imports System.Collections.Generic
Imports Crystal.Common.Model
Imports CrystalDataHub.BLL
Imports System.IO
Imports Crystal.CLL
Imports System.ComponentModel
Imports CrystalDataHub.BLL.CrystalDataHub.BLL

Namespace CrystalDataHub.Presenter
    Public Class UploadeSourcePresenter
        Implements IUploadeSourcePresenter
#Region "Fields"

        Private view As IUploadeSourceView
        Private context As CrystalEntities

#End Region

#Region "Constructors"

        Public Sub New(ByVal view As IUploadeSourceView)
            Me.view = view
            AddHandler Me.view.FindClientNameList, AddressOf view_GetClientsList
            AddHandler Me.view.FindYearList, AddressOf view_GetYearList
            AddHandler Me.view.FindProjectSummaryList, AddressOf view_GetProjectSummary
            AddHandler Me.view.FindListingSummaryList, AddressOf view_GetListingSummary
            context = New CrystalEntities()
        End Sub

#End Region

#Region "Event Handlers"

        Public Sub view_GetClientsList() Implements IUploadeSourcePresenter.view_GetClientsList
            'Using clsUploadeSourceManager As New UploadeSourceManager()
            '    Dim clsClientNameList As BindingList(Of ClientName) = clsUploadeSourceManager.GetClientList(context)
            '    Me.view.GetClientsList(clsClientNameList)
            'End Using
        End Sub

        Public Sub view_GetYearList(ByVal ClientID As Int16) Implements IUploadeSourcePresenter.view_GetYearList
            'Using clsUploadeSourceManager As New UploadeSourceManager()
            '    Dim lstYears As List(Of String) = clsUploadeSourceManager.GetProjectYear(context, ClientID)
            '    Me.view.GetYearList(lstYears)
            'End Using
        End Sub

        Public Sub view_GetProjectSummary(ByVal ClientID As Int16, ByVal Year As Integer) Implements IUploadeSourcePresenter.view_GetProjectSummary
            'Using clsUploadeSourceManager As New UploadeSourceManager()
            '    Dim lstProjectSummary As List(Of ProjectSummary) = clsUploadeSourceManager.GetProjectSummary(context, ClientID, Year)
            '    Me.view.GetProjectSummary(lstProjectSummary)
            'End Using
        End Sub

        Public Sub view_GetListingSummary(ByVal ProjectID As Integer) Implements IUploadeSourcePresenter.view_GetListingSummary
            Using clsUploadeSourceManager As New UploadeSourceManager()
                Dim lstListingSummary As IDataReader = clsUploadeSourceManager.GetProjectListings(ProjectID)
                Me.view.GetListingSummary(lstListingSummary)
            End Using
        End Sub
#End Region
    End Class
End Namespace

